package cn.itcast.util;

import java.text.SimpleDateFormat;

public class DataNumid {

    public  String getDate(String sformat){
        Date currentTime = new Date();
        SimpleDateFormat formatter = new SimpleDateFormat(sformat);
        String dateString = formatter.format(currentTime);
        return dateString;
    }

    public  String getRandomNum(int num){
        String numStr = "";
        for(int i = 0; i < num; i++){
            numStr += (int)(10*(Math.random()));
        }
        return numStr;
    }
    public  Long getGeneratID(){
        String sformat = "yyyy-MM-dd HH:mm:ss";
        int num = 3;
        String idStr = getDate(sformat) + getRandomNum(num);
        Long id = Long.valueOf(idStr);
        return id;
    }

}
